
package GUI;

public class JanelaCadastrarCliente extends javax.swing.JFrame {
    
    protected ControladorJanelaPrincipal cJC ;
    protected ControladorJanelaCadastrar cJCadastrar;

    public void setControladorJanelaCadastrar(ControladorJanelaCadastrar cJCliente) {
        this.cJCadastrar = cJCliente;
        BotaoSalvar.addActionListener(cJCadastrar);
        BotaoAlterar.addActionListener(cJCadastrar);
        BotaoSair.addActionListener(cJCadastrar);
    }
     
    public JanelaCadastrarCliente() {
        initComponents();
        setLocationRelativeTo(null);
    }

    /**
     * A classe Principal conhece a JanelaCadastrarCliente
     */
    public void setControladorJanelaPrincipal (ControladorJanelaPrincipal c){
        cJC = c;
        
    }

  
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        PainelPrincipal = new javax.swing.JPanel();
        PainelCadastro = new javax.swing.JPanel();
        LabelNome = new javax.swing.JLabel();
        LabelCPF = new javax.swing.JLabel();
        LabelEndereco = new javax.swing.JLabel();
        LabelNumero = new javax.swing.JLabel();
        LabelCidade = new javax.swing.JLabel();
        LabelBairro = new javax.swing.JLabel();
        LabelUF = new javax.swing.JLabel();
        LabelTelefone = new javax.swing.JLabel();
        LabelObs = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        CampoObs = new javax.swing.JTextArea();
        CampoNome = new javax.swing.JTextField();
        CampoRua = new javax.swing.JTextField();
        CampoNumero = new javax.swing.JTextField();
        CampoCidade = new javax.swing.JTextField();
        CampoBairro = new javax.swing.JTextField();
        CampoUF = new javax.swing.JComboBox();
        LabelCampoObrigatorio = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        campoCPF = new javax.swing.JFormattedTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        campoTelefone = new javax.swing.JFormattedTextField();
        BotaoSalvar = new javax.swing.JButton();
        BotaoSair = new javax.swing.JButton();
        BotaoAlterar = new javax.swing.JButton();

        setTitle("Cadastrar Cliente");

        PainelPrincipal.setBackground(new java.awt.Color(204, 204, 204));

        PainelCadastro.setBackground(new java.awt.Color(204, 204, 204));
        PainelCadastro.setBorder(javax.swing.BorderFactory.createTitledBorder("Cadastro de Clientes"));

        LabelNome.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelNome.setText("Nome:");

        LabelCPF.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelCPF.setText("CPF:");

        LabelEndereco.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelEndereco.setText("Rua:");

        LabelNumero.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelNumero.setText("Nº:");

        LabelCidade.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelCidade.setText("Cidade:");

        LabelBairro.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelBairro.setText("Bairro:");

        LabelUF.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelUF.setText("UF:");

        LabelTelefone.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelTelefone.setText("Telefone:");

        LabelObs.setFont(new java.awt.Font("Tahoma", 1, 12));
        LabelObs.setText("Observação:");

        CampoObs.setColumns(20);
        CampoObs.setLineWrap(true);
        CampoObs.setRows(5);
        jScrollPane1.setViewportView(CampoObs);

        CampoUF.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "RN", "CE", "PB", "PE" }));

        LabelCampoObrigatorio.setFont(new java.awt.Font("Tahoma", 1, 11));
        LabelCampoObrigatorio.setForeground(new java.awt.Color(204, 0, 0));
        LabelCampoObrigatorio.setText("* Campo obrigatório");

        jLabel11.setForeground(new java.awt.Color(204, 0, 0));
        jLabel11.setText("*");

        jLabel12.setForeground(new java.awt.Color(204, 0, 0));
        jLabel12.setText("*");

        try {
            campoCPF.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        jLabel13.setForeground(new java.awt.Color(204, 0, 0));
        jLabel13.setText("*");

        jLabel14.setForeground(new java.awt.Color(204, 0, 0));
        jLabel14.setText("*");

        jLabel15.setForeground(new java.awt.Color(204, 0, 0));
        jLabel15.setText("*");

        jLabel16.setForeground(new java.awt.Color(204, 0, 0));
        jLabel16.setText("*");

        try {
            campoTelefone.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        javax.swing.GroupLayout PainelCadastroLayout = new javax.swing.GroupLayout(PainelCadastro);
        PainelCadastro.setLayout(PainelCadastroLayout);
        PainelCadastroLayout.setHorizontalGroup(
            PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PainelCadastroLayout.createSequentialGroup()
                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(LabelCampoObrigatorio))
                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(LabelCidade)
                            .addGroup(PainelCadastroLayout.createSequentialGroup()
                                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(LabelObs)
                                    .addComponent(LabelNome)
                                    .addComponent(LabelCPF)
                                    .addComponent(LabelEndereco)
                                    .addComponent(LabelTelefone))
                                .addGap(18, 18, 18)
                                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                                        .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(CampoNome, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                                            .addComponent(CampoRua, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                                            .addComponent(campoCPF, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PainelCadastroLayout.createSequentialGroup()
                                                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(campoTelefone, javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(CampoCidade, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                                        .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(PainelCadastroLayout.createSequentialGroup()
                                                .addGap(2, 2, 2)
                                                .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(LabelNumero)
                                                    .addComponent(LabelBairro))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                                                        .addComponent(CampoNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(LabelUF)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(CampoUF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                                                        .addComponent(CampoBairro, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addGap(121, 121, 121))
                                            .addGroup(PainelCadastroLayout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))))))))))
                .addContainerGap())
        );
        PainelCadastroLayout.setVerticalGroup(
            PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PainelCadastroLayout.createSequentialGroup()
                .addComponent(LabelCampoObrigatorio)
                .addGap(29, 29, 29)
                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelNome)
                    .addComponent(CampoNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LabelCPF)
                            .addComponent(campoCPF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel12)))
                .addGap(18, 18, 18)
                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelEndereco)
                    .addComponent(CampoRua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(LabelNumero)
                    .addComponent(CampoNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(jLabel15)
                    .addComponent(LabelUF)
                    .addComponent(CampoUF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelCidade)
                    .addComponent(CampoCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(LabelBairro)
                    .addComponent(CampoBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16)
                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                        .addGap(23, 23, 23)
                        .addComponent(LabelTelefone))
                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(PainelCadastroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                        .addGap(53, 53, 53)
                        .addComponent(LabelObs))
                    .addGroup(PainelCadastroLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(34, 34, 34))
        );

        BotaoSalvar.setBackground(new java.awt.Color(255, 255, 255));
        BotaoSalvar.setFont(new java.awt.Font("Tahoma", 1, 12));
        BotaoSalvar.setText("Salvar");

        BotaoSair.setBackground(new java.awt.Color(255, 255, 255));
        BotaoSair.setFont(new java.awt.Font("Tahoma", 1, 12));
        BotaoSair.setText("Sair");
        BotaoSair.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        BotaoAlterar.setBackground(new java.awt.Color(255, 255, 255));
        BotaoAlterar.setFont(new java.awt.Font("Tahoma", 1, 12));
        BotaoAlterar.setText("Alterar");

        javax.swing.GroupLayout PainelPrincipalLayout = new javax.swing.GroupLayout(PainelPrincipal);
        PainelPrincipal.setLayout(PainelPrincipalLayout);
        PainelPrincipalLayout.setHorizontalGroup(
            PainelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PainelPrincipalLayout.createSequentialGroup()
                .addGroup(PainelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PainelPrincipalLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(BotaoSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoAlterar, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoSair, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PainelPrincipalLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(PainelCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 654, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        PainelPrincipalLayout.setVerticalGroup(
            PainelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PainelPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PainelCadastro, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(PainelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotaoAlterar, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoSair, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(13, 13, 13))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PainelPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PainelPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

        
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotaoAlterar;
    private javax.swing.JButton BotaoSair;
    private javax.swing.JButton BotaoSalvar;
    private javax.swing.JTextField CampoBairro;
    private javax.swing.JTextField CampoCidade;
    private javax.swing.JTextField CampoNome;
    private javax.swing.JTextField CampoNumero;
    private javax.swing.JTextArea CampoObs;
    private javax.swing.JTextField CampoRua;
    private javax.swing.JComboBox CampoUF;
    private javax.swing.JLabel LabelBairro;
    private javax.swing.JLabel LabelCPF;
    private javax.swing.JLabel LabelCampoObrigatorio;
    private javax.swing.JLabel LabelCidade;
    private javax.swing.JLabel LabelEndereco;
    private javax.swing.JLabel LabelNome;
    private javax.swing.JLabel LabelNumero;
    private javax.swing.JLabel LabelObs;
    private javax.swing.JLabel LabelTelefone;
    private javax.swing.JLabel LabelUF;
    private javax.swing.JPanel PainelCadastro;
    private javax.swing.JPanel PainelPrincipal;
    private javax.swing.JFormattedTextField campoCPF;
    private javax.swing.JFormattedTextField campoTelefone;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

    public String getCampoNome() {
        return CampoNome.getText();
    }

    public void setCampoNome(String CampoNome) {
        this.CampoNome.setText(CampoNome);
    }

    public String getCampoObs() {
        return CampoObs.getText();
    }

    public void setCampoObs(String CampoObs) {
        this.CampoObs.setText(CampoObs);
    }

    public String getCampoCPF() {
        return campoCPF.getText();
    }

    public void setCampoCPF(String campoCPF) {
        this.campoCPF.setText(campoCPF);
    }

    public String getCampoBairro() {
        return CampoBairro.getText();
    }

    public void setCampoBairro(String CampoBairro) {
        this.CampoBairro.setText(CampoBairro);
    }

    public String getCampoCidade() {
        return CampoCidade.getText();
    }

    public void setCampoCidade(String CampoCidade) {
        this.CampoCidade.setText(CampoCidade);
    }

    public String getCampoNumero() {
        return CampoNumero.getText();
    }

    public void setCampoNumero(String CampoNumero) {
        this.CampoNumero.setText(CampoNumero);
    }

    public String getCampoRua() {
        return CampoRua.getText();
    }

    public void setCampoRua(String CampoRua) {
        this.CampoRua.setText(CampoRua);
    }

    public String getCampoUF() {
        return CampoUF.getSelectedItem().toString();
    }

    public void setCampoUF(String CampoUF) {
        this.CampoUF.setToolTipText(CampoUF);
    }

    public String getCampoTelefone() {
        return campoTelefone.getText();
    }

    public void setCampoTelefone(String campoTelefone) {
        this.campoTelefone.setText(campoTelefone);
    }



    
   
}
